home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2001 May / maximum-cd-2001-05.iso / Blade of Darkness / data1.cab / Program_Executable_Files / Lib / Scorer.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2000-11-16  |  24.0 KB  |  277 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. import BUIx
  5. import Bladex
  6. import ScorerWidgets
  7. import WidgetsExtra
  8. import ScorerActions
  9. import PowDefWidgets
  10. import Raster
  11. import B3DLib
  12. import math
  13. import CharStats
  14. import MenuText
  15. ENERGY_LOW_LEVEL
  16. DEMO_MODE
  17. wGameText.SetAlpha(1)
  18. wGameText.SetColor(255, 255, 255)
  19. TBookSword.SetColor(255, 255, 255)
  20. wFrame.AddWidget(TBookSword, 0, 0, BUIx.B_FrameWidget.B_FR_AbsoluteRight, BUIx.B_FrameWidget.B_FR_Right, BUIx.B_FrameWidget.B_FR_AbsoluteBottom, BUIx.B_FrameWidget.B_FR_Bottom)
  21. TBookSword.SetAlpha(1.0)
  22. TBookSword.SetVisible(0)
  23. TBS.Volume = 1.0
  24. TBS.MinDistance = 1000000.0
  25. TBS.MaxDistance = 2000000
  26. Bladex.ReadBitMap('../../Data/Vida.bmp', 'Vida')
  27. Bladex.ReadBitMap('../../Data/Vida enemigo 8.bmp', 'BitmapBarraEnemigo')
  28. wLifeBar.SetColor(255, 0, 0)
  29. wLifeBar.SetFlashColor(53, 141, 36)
  30. wLifeBar.SetFlash(0)
  31. wLifeBar.Continuous = 1
  32. wLifeBar.SetBackgroundAlpha(0.0)
  33. wLifeBar.SetAlpha(1.0)
  34. wLifeBar.SetBitmap('Vida')
  35. wLifeLabel.SetColor(255, 0, 0)
  36. wLifeLabel.SetAlpha(1.0)
  37. wLifeBar.AddLabel(wLifeLabel, 4 - BAR_DELTA, -2, BUIx.B_Widget.B_LAB_Right, BUIx.B_Widget.B_LAB_VCenter, BUIx.B_Widget.B_FR_AbsoluteLeft, BUIx.B_Widget.B_FR_Left, BUIx.B_Widget.B_FR_AbsoluteTop, BUIx.B_Widget.B_FR_Top)
  38. wPoisonLabel.SetColor(85, 105, 60)
  39. wPoisonLabel.SetAlpha(1.0)
  40. wLifeBar.AddLabel(wPoisonLabel, 0.4, 0.5, BUIx.B_Widget.B_LAB_HCenter, BUIx.B_Widget.B_LAB_VCenter, BUIx.B_Widget.B_FR_HRelative, BUIx.B_Widget.B_FR_HCenter, BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter)
  41. wPoisonLabel.SetVisible(0)
  42. wLifeMarker.SetColor(255, 255, 255)
  43. wLifeMarker.SetAlpha(1.0)
  44. wLevelBar.SetColor(CURRENT_LEVEL_R, CURRENT_LEVEL_G, CURRENT_LEVEL_B)
  45. wLevelBar.SetAlpha(1.0)
  46. wLevelBar.SetBackgroundAlpha(0.0)
  47. wLevelBar.SetBackgroundColor(0, 80, 110)
  48. wLevelUpLabel.SetColor(170, 170, 170)
  49. wLevelUpLabel.SetAlpha(1.0)
  50. wLevelUpLabel.SetVisible(0)
  51. wLevelBar.AddLabel(wLevelUpLabel, 0, 2, BUIx.B_Widget.B_LAB_HCenter, BUIx.B_Widget.B_LAB_Bottom, BUIx.B_Widget.B_FR_AbsoluteRight, BUIx.B_Widget.B_FR_Right, BUIx.B_Widget.B_FR_AbsoluteTop, BUIx.B_Widget.B_FR_Top)
  52. wCurrentLevelLabel.SetColor(0, 159, 220)
  53. wCurrentLevelLabel.SetAlpha(1.0)
  54. wLevelBar.AddLabel(wCurrentLevelLabel, 6 - BAR_DELTA, -4, BUIx.B_Widget.B_LAB_Right, BUIx.B_Widget.B_LAB_VCenter, BUIx.B_Widget.B_FR_AbsoluteLeft, BUIx.B_Widget.B_FR_Left, BUIx.B_Widget.B_FR_AbsoluteTop, BUIx.B_Widget.B_FR_Top)
  55. wLevelBar.SetBitmap('Vida')
  56. wLowBarFrame.SetVisible(1)
  57. wEnergyBmp.SetColor(255, 255, 255)
  58. wEnergyBmp.SetAlpha(1.0)
  59. wEnergyBmp.SetVisible(1)
  60. wStrengthBar.SetColor(CURRENT_STRENGTH_R, CURRENT_STRENGTH_G, CURRENT_STRENGTH_B)
  61. wStrengthBar.SetAlpha(0.75)
  62. wStrengthBar.SetBackgroundAlpha(0.0)
  63. wStrengthBar.SetBackgroundColor(CURRENT_STRENGTH_R, CURRENT_STRENGTH_G, CURRENT_STRENGTH_B)
  64. wStrengthBar.SetVisible(0)
  65. wStrengthBar.SetBitmap('Vida')
  66. wMaxPowerLabel.SetColor(255, 255, 255)
  67. wMaxPowerLabel.SetAlpha(1.0)
  68. wMaxPowerLabel.SetVisible(0)
  69. wStrengthBar.AddLabel(wMaxPowerLabel, 0.4, 0.5, BUIx.B_Widget.B_LAB_HCenter, BUIx.B_Widget.B_LAB_VCenter, BUIx.B_Widget.B_FR_HRelative, BUIx.B_Widget.B_FR_HCenter, BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter)
  70. wStrengthLabel.SetColor(251, 210, 99)
  71. wStrengthLabel.SetAlpha(1.0)
  72. wStrengthLabel.SetFlash(0.0)
  73. wStrengthBar.AddLabel(wStrengthLabel, 9, 0.5, BUIx.B_Widget.B_LAB_Left, BUIx.B_Widget.B_LAB_VCenter, BUIx.B_Widget.B_FR_AbsoluteRight, BUIx.B_Widget.B_FR_Right, BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter)
  74. wEnergyBar.SetColor(0, 255, 128)
  75. wEnergyBar.SetAlpha(0.75)
  76. wEnergyBar.SetBackgroundAlpha(0.0)
  77. wEnergyBar.SetBackgroundColor(64, 64, 64)
  78. wEnergyBar.SetVisible(0)
  79. wEnergyBar.SetBitmap('Vida')
  80. wDangerLabel.SetColor(238, 191, 0)
  81. wDangerLabel.SetAlpha(1.0)
  82. wDangerLabel.SetVisible(0)
  83. wEnergyBar.AddLabel(wDangerLabel, 0.4, 0.5, BUIx.B_Widget.B_LAB_HCenter, BUIx.B_Widget.B_LAB_VCenter, BUIx.B_Widget.B_FR_HRelative, BUIx.B_Widget.B_FR_HCenter, BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter)
  84. wEnergyMaxLabel.SetColor(0, 255, 128)
  85. wEnergyMaxLabel.SetAlpha(1)
  86. wEnergyMaxLabel.SetVisible(1)
  87. wEnergyBar.AddLabel(wEnergyMaxLabel, 7, 0.5, BUIx.B_Widget.B_LAB_Left, BUIx.B_Widget.B_LAB_VCenter, BUIx.B_Widget.B_FR_AbsoluteRight, BUIx.B_Widget.B_FR_Right, BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter)
  88. wLowBarFrame.AddWidget(wStrengthBar, 56, 6)
  89. wLowBarFrame.AddWidget(wEnergyBar, 56, 6)
  90. wLowBarFrame.AddWidget(wEnergyBmp, 0, 0)
  91. (wEnemy1, wEnemyVenom1, wEnemy1LifeLabel, wEnemy1LevelLabel, wEnemy1KeyLabel, wEnemy1ObjLabel, wEnemy1BarrLabel) = ScorerWidgets.CreateEnemyWidget('wEnemy1', wEnemiesFrame, wants_auto_scale)
  92. wEnemy1.SetAlpha(0.25)
  93. (wEnemy2, wEnemyVenom2, wEnemy2LifeLabel, wEnemy2LevelLabel, wEnemy2KeyLabel, wEnemy2ObjLabel, wEnemy2BarrLabel) = ScorerWidgets.CreateEnemyWidget('wEnemy2', wEnemiesFrame, wants_auto_scale)
  94. wEnemy2.SetAlpha(1.0)
  95. (wEnemy3, wEnemyVenom3, wEnemy3LifeLabel, wEnemy3LevelLabel, wEnemy3KeyLabel, wEnemy3ObjLabel, wEnemy3BarrLabel) = ScorerWidgets.CreateEnemyWidget('wEnemy3', wEnemiesFrame, wants_auto_scale, 35)
  96. wEnemy3.SetAlpha(0.25)
  97. (wEnemy4, wEnemyVenom4, wEnemy4LifeLabel, wEnemy4LevelLabel, wEnemy4KeyLabel, wEnemy4ObjLabel, wEnemy4BarrLabel) = ScorerWidgets.CreateEnemyWidget('wEnemy4', wEnemiesFrame, wants_auto_scale)
  98. wEnemy4.SetAlpha(0.25)
  99. (wEnemy5, wEnemyVenom5, wEnemy5LifeLabel, wEnemy5LevelLabel, wEnemy5KeyLabel, wEnemy5ObjLabel, wEnemy5BarrLabel) = ScorerWidgets.CreateEnemyWidget('wEnemy5', wEnemiesFrame, wants_auto_scale)
  100. wEnemy5.SetAlpha(0.25)
  101. wLeftFrame.AddWidget(wLifeBar, 14, 6)
  102. wLeftFrame.AddWidget(wLevelBar, 14, 24)
  103. wLeftFrame.AddWidget(wLifeMarker, 1, 1)
  104. wObjectsFrame.AddWidget(wKey1, 0, 72)
  105. wLeftFrame.AddWidget(wSpecialsFrame, 15, 38)
  106. wSpecialsFrame.AddWidget(wSpecialKey1, 0, 0)
  107. wSpecialsFrame.AddWidget(wSpecialKey2, 21, 0)
  108. wSpecialsFrame.AddWidget(wSpecialKey3, 43, 0)
  109. wSpecialsFrame.AddWidget(wSpecialKey4, 65, 0)
  110. wSpecialsFrame.AddWidget(wTablet1, 96 - dlt, 0)
  111. wSpecialsFrame.AddWidget(wTablet2, 110 - dlt, 0)
  112. wSpecialsFrame.AddWidget(wTablet3, 124 - dlt, 0)
  113. wSpecialsFrame.AddWidget(wTablet4, 138 - dlt, 0)
  114. wSpecialsFrame.AddWidget(wTablet5, 152 - dlt, 0)
  115. wSpecialsFrame.AddWidget(wTablet6, 166 - dlt, 0)
  116. wEnemiesFrame.AddWidget(wEnemyLeft, 0, E_EDGAL_DISTANCE, BUIx.B_FrameWidget.B_FR_AbsoluteRight, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteTop, BUIx.B_FrameWidget.B_FR_Top)
  117. wEnemyLeft.SetAlpha(1.0)
  118. wEnemyLeft.SetColor(255, 255, 255)
  119. wEnemiesFrame.AddWidget(wEnemies[i], E_ICON_DISTANCE * i + c * E_CENTRAL_DISTANCE + E_ARROW_DISTANCE, E_EDGAL_DISTANCE, BUIx.B_FrameWidget.B_FR_AbsoluteRight, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteTop, BUIx.B_FrameWidget.B_FR_Top)
  120. wEnemiesFrame.AddWidget(wEnemies[i], E_ICON_DISTANCE * i + c * E_CENTRAL_DISTANCE + E_ARROW_DISTANCE, E_EDGAL_DISTANCE, BUIx.B_FrameWidget.B_FR_AbsoluteRight, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteTop, BUIx.B_FrameWidget.B_FR_Top)
  121. wEnemiesFrame.AddWidget(wEnemyMark, 0.56, -10, BUIx.B_FrameWidget.B_FR_HRelative, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteTop, BUIx.B_FrameWidget.B_FR_Top)
  122. wEnemyMark.SetAlpha(1.0)
  123. wEnemyMark.SetColor(255, 255, 255)
  124. wEnemyBorderSelector.SetBorderColor(255, 0, 0)
  125. wEnemies[i].AddLabel(wEnemyBorderSelector, 0, 0, BUIx.B_Widget.B_LAB_HCenter, BUIx.B_Widget.B_LAB_VCenter, BUIx.B_Widget.B_FR_Left, BUIx.B_Widget.B_FR_Left, BUIx.B_Widget.B_FR_AbsoluteTop, BUIx.B_Widget.B_FR_Top)
  126. wEnemiesFrame.AddWidget(wEnemies[i], E_ICON_DISTANCE * i + c * E_CENTRAL_DISTANCE + E_ARROW_DISTANCE, E_EDGAL_DISTANCE, BUIx.B_FrameWidget.B_FR_AbsoluteRight, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteTop, BUIx.B_FrameWidget.B_FR_Top)
  127. wEnemiesFrame.AddWidget(wEnemies[i], E_ICON_DISTANCE * i + c * E_CENTRAL_DISTANCE + E_ARROW_DISTANCE, E_EDGAL_DISTANCE, BUIx.B_FrameWidget.B_FR_AbsoluteRight, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteTop, BUIx.B_FrameWidget.B_FR_Top)
  128. wEnemiesFrame.AddWidget(wEnemies[i], E_ICON_DISTANCE * i + c * E_CENTRAL_DISTANCE + E_ARROW_DISTANCE, E_EDGAL_DISTANCE, BUIx.B_FrameWidget.B_FR_AbsoluteRight, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteTop, BUIx.B_FrameWidget.B_FR_Top)
  129. wEnemiesFrame.AddWidget(wEnemyRight, E_ICON_DISTANCE * 5 + 2 * E_CENTRAL_DISTANCE + E_ARROW_DISTANCE, E_EDGAL_DISTANCE, BUIx.B_FrameWidget.B_FR_AbsoluteRight, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteTop, BUIx.B_FrameWidget.B_FR_Top)
  130. wEnemyRight.SetAlpha(1.0)
  131. wEnemyRight.SetColor(255, 255, 255)
  132. wFrame.AddWidget(wLeftFrame, 4, 4)
  133. wFrame.AddWidget(wObjectsFrame, 12, 0, BUIx.B_FrameWidget.B_FR_AbsoluteRight, BUIx.B_FrameWidget.B_FR_Right, BUIx.B_FrameWidget.B_FR_AbsoluteTop, BUIx.B_FrameWidget.B_FR_Top)
  134. wFrame.AddWidget(wEnemiesFrame, 0.5, 0, BUIx.B_FrameWidget.B_FR_HRelative, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteTop, BUIx.B_FrameWidget.B_FR_Top)
  135. wFrame.AddWidget(wRightHand, 6, 20, BUIx.B_FrameWidget.B_FR_AbsoluteRight, BUIx.B_FrameWidget.B_FR_Right, BUIx.B_FrameWidget.B_FR_AbsoluteBottom, BUIx.B_FrameWidget.B_FR_Bottom)
  136. wFrame.AddWidget(wLeftHand, 6, 20, BUIx.B_FrameWidget.B_FR_AbsoluteLeft, BUIx.B_FrameWidget.B_FR_Left, BUIx.B_FrameWidget.B_FR_AbsoluteBottom, BUIx.B_FrameWidget.B_FR_Bottom)
  137. wFrame.AddWidget(wArrowInfo, 6, 20, BUIx.B_FrameWidget.B_FR_AbsoluteLeft, BUIx.B_FrameWidget.B_FR_Left, BUIx.B_FrameWidget.B_FR_AbsoluteBottom, BUIx.B_FrameWidget.B_FR_Bottom)
  138. wFrame.AddWidget(wGameText, 0.5, 27, BUIx.B_FrameWidget.B_FR_HRelative, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteBottom, BUIx.B_FrameWidget.B_FR_Bottom)
  139. wFrame.AddWidget(wLowBarFrame, 0.5, 2, BUIx.B_FrameWidget.B_FR_HRelative, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteBottom, BUIx.B_FrameWidget.B_FR_Bottom)
  140. PowDefWidgets.CreateWidgest()
  141. PowDefWidgets.Activate()
  142. wFrame.SetAutoScale(1)
  143. ObjectsControl.view_period = 3.0
  144.  
  145. def ActivateScorer():
  146.     wLeftHand.SetVisible(0)
  147.     wRightHand.SetVisible(0)
  148.     wObjectsFrame.SetVisible(0)
  149.     wSpecialsFrame.SetVisible(1)
  150.     Bladex.SetRootWidget(wFrame.GetPointer())
  151.  
  152.  
  153. def ViewScorer(v):
  154.     wFrame.SetVisible(v)
  155.  
  156.  
  157. def ViewEnemies(v):
  158.     wEnemiesFrame.SetVisible(v)
  159.  
  160.  
  161. def ViewBars(v):
  162.     wLeftFrame.SetVisible(v)
  163.  
  164.  
  165. def ViewObjects(v):
  166.     wObjectsFrame.SetVisible(v)
  167.  
  168.  
  169. def AddLifeValue(v):
  170.     wLifeBar.AddValue(v)
  171.  
  172. last_poisoned = 0
  173.  
  174. def SetLifeValue(v, maxvalue, poisoned):
  175.     global last_poisoned
  176.     wLifeBar.SetPositionPercentage((v / maxvalue) * (6.5 / 8.0))
  177.     wLifeLabel.SetText(str(int(v)) + '/' + str(maxvalue))
  178.     if poisoned != last_poisoned:
  179.         wPoisonLabel.SetVisible(poisoned)
  180.         last_poisoned = poisoned
  181.         if poisoned:
  182.             wLifeBar.SetColor(0, 66, 19)
  183.             wLifeBar.SetFlash(3)
  184.         else:
  185.             wLifeBar.SetColor(255, 0, 0)
  186.             wLifeBar.SetFlash(0)
  187.     
  188.  
  189.  
  190. def SetLevelValue(v):
  191.     wCurrentLevelLabel.SetText(MenuText.GetMenuText('Level') + ' ' + str(v + 1))
  192.  
  193.  
  194. def SetLevelBarValue(v):
  195.     wLevelBar.SetPosition(v * (6.5 / 8.0))
  196.  
  197.  
  198. def SetLevelLimits(inf, sup):
  199.     wLevelBar.SetLimits(inf, sup)
  200.  
  201.  
  202. def __level_up_aux():
  203.     wLevelUpLabel.SetFlash(0)
  204.     wLevelUpLabel.SetVisible(0)
  205.  
  206.  
  207. def LevelUp():
  208.     wLevelUpLabel.SetFlash(15)
  209.     wLevelUpLabel.SetVisible(1)
  210.     now = Bladex.GetTime()
  211.     Bladex.AddScheduledFunc(now + 2.0, __level_up_aux, ())
  212.  
  213. VISIBLE = 1
  214.  
  215. def SetStrengthBarValue(v):
  216.     wEnergyBar.SetVisible(0)
  217.     if VISIBLE:
  218.         wStrengthBar.SetVisible(1)
  219.     
  220.     old_pos = wStrengthBar.GetPositionPercentage()
  221.     wStrengthBar.SetPositionPercentage(v * (6.5 / 8.0))
  222.     if v >= 1.0:
  223.         if old_pos < 1.0:
  224.             wMaxPowerLabel.SetFlash(14)
  225.             wStrengthLabel.SetFlash(14)
  226.             wMaxPowerLabel.SetVisible(1)
  227.         
  228.     else:
  229.         wMaxPowerLabel.SetVisible(0)
  230.         wStrengthLabel.SetFlash(0.0)
  231.  
  232.  
  233. def SetEnergyBarValue(v, max_v):
  234.     wStrengthBar.SetVisible(0)
  235.     if VISIBLE:
  236.         wEnergyBar.SetVisible(1)
  237.     
  238.     pos = min(max(v / max_v, 0), 1.0)
  239.     wEnergyBar.SetPositionPercentage(pos * (6.5 / 8.0))
  240.     wEnergyMaxLabel.SetText(`max_v`)
  241.     wEnergyBar.RecalcLabelLayout(BUIx.B_Widget.B_LAB_Left, BUIx.B_Widget.B_LAB_VCenter)
  242.     if pos <= ENERGY_LOW_LEVEL:
  243.         wDangerLabel.SetFlash(14)
  244.         wDangerLabel.SetVisible(1)
  245.     else:
  246.         wDangerLabel.SetVisible(0)
  247.  
  248.  
  249. def SetVisible(vis):
  250.     global VISIBLE
  251.     VISIBLE = vis
  252.     if vis == 0:
  253.         HideTBS()
  254.         wLeftHand.SetVisible(vis)
  255.         wRightHand.SetVisible(0)
  256.         PowDefWidgets.Deactivate()
  257.     else:
  258.         PowDefWidgets.Activate()
  259.     wSpecialsFrame.SetVisible(vis)
  260.     wEnemiesFrame.SetVisible(vis)
  261.     wLeftFrame.SetVisible(vis)
  262.     wArrowInfo.SetVisible(vis)
  263.     wEnergyBar.SetVisible(0)
  264.     wStrengthBar.SetVisible(0)
  265.     wStrengthBar.SetVisible(0)
  266.     wLowBarFrame.SetVisible(0)
  267.     wObjectsFrame.SetVisible(0)
  268.  
  269.  
  270. def LevelUpFlash():
  271.     if not wLifeBar.GetFlash():
  272.         wLifeBar.SetFlash(22)
  273.         Bladex.AddScheduledFunc(Bladex.GetTime() + 2.0, wLifeBar.SetFlash, (0,))
  274.     
  275.     PowDefWidgets.FlashWidgest()
  276.  
  277.